package com.whmskj.xjlhsc.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * @BelongsProject: XJLHSC
 * @BelongsPackage: com.whmskj.xjlhsc.enums
 * @Author: lk
 * @CreateTime: 2025-06-16
 * @Description: TODO
 * @Version: 1.0
 */
@Getter
public class    ScEnums {



    /**
     * 维保记录状态-纱厂
     */
    @Getter
    public enum SCWBJLZT {
        COMPLETED(101, "已完成"), PENDING_REVIEW(102, "待审核"), REJECTED(103, "驳回");

        @EnumValue
        private final int code;
        @JsonValue
        private final String description;

        SCWBJLZT(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保统计状态-纱厂
     */
    @Getter
    public enum SCWBTJZT {

        PROCESSED(104, "已处理"), IN_MAINTENANCE(105, "维保中"), PENDING_REVIEW2(106, "待审核"), UNPROCESSED(107, "未处理"), OVERDUE(108, "已逾期");

        private final int code;
        private final String description;

        SCWBTJZT(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保监督状态-纱厂
     */
    @Getter
    public enum SCWBJDZT {
        UNPROCESSED(112, "未处理"), OVERD(113, "已逾期"), REJECTED(114, "驳回"), PROCESSED(115, "维保中(待审核)"), PASS(119, "审核通过");

        private final int code;
        private final String description;

        SCWBJDZT(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保审核状态-纱厂
     */
    @Getter
    public enum SCWBSHZT {
        UNAPP(116, "未审核"), APPED(117, "审核通过"), REJECTED(118, "驳回");

        private final int code;
        private final String description;

        SCWBSHZT(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保类型-纱厂
     */
    @Getter
    public enum SCWBLX {
        WB(100, "维保");
        @EnumValue
        private final int code;
        @JsonValue
        private final String description;

        SCWBLX(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保状态-纱厂
     */
    @Getter
    public enum SCWBZT {
        UNGEN(99, "未生成"), GENED(98, "已生成");

        private final int code;
        private final String description;

        SCWBZT(int code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保项目-纱厂
     */
    @Getter
    public enum SCWBXM {
        KC(96, "揩车"), JX(97, "检修");
        @EnumValue
        private final int code;
        @JsonValue
        private final String description;

        SCWBXM(int code, String description) {
            this.code = code;
            this.description = description;
        }

        public static String getDescriptionByCode(int code) {
            for (SCWBXM value : SCWBXM.values()) {
                if (value.code == code) {
                    return value.description;
                }
            }
            return null;
        }
    }

    /**
     * 月份类型-纱厂
     */
    @Getter
    public enum MONTH_TYPE {
        ZRY("ZRY", "自然月"), JXY("JXY", "绩效月");

        private final String code;
        private final String description;

        MONTH_TYPE(String code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 统计类型-纱厂
     */
    @Getter
    public enum ITEM_TYPE {
        PROJECT("PROJECT", "项目名称"), DEVICE("DEVICE", "机台号");

        private final String code;
        private final String description;

        ITEM_TYPE(String code, String description) {
            this.code = code;
            this.description = description;
        }
    }

    /**
     * 维保检修-标签类型-纱厂
     */
    @Getter
    public enum TAG_TYPE {
        ALL, TODO;
    }

    /**
     * 维保检修-标签类型-纱厂
     */
    @Getter
    public enum COLLECT_STATE {
        NORMAL("正常"), FAIL("异常");
        private final String description;

        COLLECT_STATE(String description) {
            this.description = description;
        }
    }

    /**
     * 运转班班次-纱厂
     */
    @Getter
    public enum SCCLASS {
        AM("早班"), PM("晚班");
        private final String description;

        SCCLASS(String description) {
            this.description = description;
        }
    }
    /**
     * 员工签到绑定机台审批状态-纱厂
     */
    @Getter
    public enum ConfirmStatus {
        CONFIRMED("已确认"), UNCONFIRMED("未确认"),REJECT("驳回"),UNSELECTED("未选择");
        private final String description;

        ConfirmStatus(String description) {
            this.description = description;
        }
    }


    /**
     * 工序对应数采表映射-纱厂
     */
    @Getter
    public enum SC_PROCESS_TABLE_MAPPING {
        HUMIDIFICATION("加湿", "sc_humidification_info"), FIRST_DOUBLING("头并", "shiftdatacurrent#MachineNumber#Date_Time"), PACKING("打包", "sc_packing_info"), LAST_DOUBLING("末并", "shiftdatacurrent"), LAP_FORMING("条卷", "sc_lap_forming_info"), CARDING("梳棉", "sc_carding_info"), CLEANING("清花", "sc_cleaning_info"), ROVING("粗纱", "sc_roving_info"), COMBING("精梳", "sc_combing_info"), SPINNING("细纱", "sc_spinning_info"), WINDING("络筒", "device_reports_current#machine_number#timestamp");

        private final String processName;
        private final String realInfoTableName;

        SC_PROCESS_TABLE_MAPPING(String processName, String realInfoTableName) {
            this.processName = processName;
            this.realInfoTableName = realInfoTableName;
        }

        public static String getRealInfoTableNameByProcessName(String processName) {
            for (SC_PROCESS_TABLE_MAPPING value : SC_PROCESS_TABLE_MAPPING.values()) {
                if (value.processName.equals(processName)) {
                    return value.realInfoTableName;
                }
            }
            return null;
        }
    }


}
